﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class crm_individuals_IndividualsReceiptInfor_ : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            if (Request.Params["ind_urn"] != null && Request.Params["ind_urn"] != "")
            {
                emp.BLL.Individuals ii = new emp.BLL.Individuals();
                DataTable dt= ii.getAttachmentByInd_urn(Request.Params["ind_urn"].ToString());
                into(dt);
            }
        }
    }



    void into(DataTable dt) 
    {
      
      this.INA_IND_URN.Text=dt.Rows[0]["INA_IND_URN"].ToString();
      this.INA_IND_NAME.Text = dt.Rows[0]["INA_IND_NAME"].ToString();
      this.INA_IND_MOBILEPHONE_1.Text = dt.Rows[0]["INA_IND_MOBILEPHONE_1"].ToString();
      this.INA_IND_MOBILEPHONE_2.Text = dt.Rows[0]["INA_IND_MOBILEPHONE_2"].ToString();
      this.INA_CAM_NAME.Text = dt.Rows[0]["INA_CAM_NAME"].ToString();
      if (dt.Rows[0]["INA_IS_CARD"].ToString() == "是")
      {
          this.INA_IS_CARD1.Checked = true;
      }
      else 
      {
          this.INA_IS_CARD2.Checked = true;
      }
      this.INA_CNAME.Text = dt.Rows[0]["INA_CNAME"].ToString();
      this.INA_CCOMPANY.Text = dt.Rows[0]["INA_CCOMPANY"].ToString();
      this.INA_CTITLE.Text = dt.Rows[0]["INA_CTITLE"].ToString();
      if (dt.Rows[0]["INA_IS_DLICENSE"].ToString() == "是")
      {
          this.INA_IS_DLICENSE1.Checked = true;
      }
      else
      {
          this.INA_IS_DLICENSE2.Checked = true;
      }
      this.INA_DNAME.Text = dt.Rows[0]["INA_DNAME"].ToString();
      this.INA_DPROVINCE.Text = dt.Rows[0]["INA_DPROVINCE"].ToString();
      this.INA_DCITY.Text = dt.Rows[0]["INA_DCITY"].ToString();
      if (dt.Rows[0]["INA_DTIME"].ToString() == "1900/1/1 0:00:00")
      {
          this.INA_DTIME.Text = "";
      }
      else
      {
          
          this.INA_DTIME.Text = string.Format("{0:D}", Convert.ToDateTime(dt.Rows[0]["INA_DTIME"].ToString()));
      }
      if (dt.Rows[0]["IND_DBTIME"].ToString() == "1900/1/1 0:00:00")
      {
          this.IND_DBTIME.Text = "";
      }
      else
      {
          this.IND_DBTIME.Text = string.Format("{0:D}", Convert.ToDateTime(dt.Rows[0]["IND_DBTIME"].ToString()));
      }
      if (dt.Rows[0]["INA_IS_PERMIT"].ToString() == "是")
      {
          this.INA_IS_PERMIT1.Checked = true;
      }
      else
      {
          this.INA_IS_PERMIT2.Checked = true;
      }
      this.INA_PNAME.Text = dt.Rows[0]["INA_PNAME"].ToString();
      this.INA_PBRAND.Text = dt.Rows[0]["INA_PBRAND"].ToString();
      this.INA_PMODEL.Text = dt.Rows[0]["INA_PMODEL"].ToString();
      
      this.INA_PNO.Text = dt.Rows[0]["INA_PNO"].ToString();
      
      if (dt.Rows[0]["INA_PTIME"].ToString() == "1900/1/1 0:00:00")
      {
          this.INA_PTIME.Text = "";
      }
      else
      {

          this.INA_PTIME.Text = string.Format("{0:D}", Convert.ToDateTime(dt.Rows[0]["INA_PTIME"].ToString()));
      }
      
      this.IND_PPRICE.Text = dt.Rows[0]["IND_PPRICE"].ToString();
      
      if (dt.Rows[0]["IND_IS_IDENTITY"].ToString() == "是")
      {
          this.IND_IS_IDENTITY1.Checked = true;
      }
      else
      {
          this.IND_IS_IDENTITY2.Checked = true;
      }
      this.IND_INAME.Text = dt.Rows[0]["IND_INAME"].ToString();
      this.IND_ICARD.Text = dt.Rows[0]["IND_ICARD"].ToString();
      if (dt.Rows[0]["IND_IBRITHDAY"].ToString() == "1900/1/1 0:00:00")
      {
          this.IND_IBRITHDAY.Text = "";
      }
      else
      {
          this.IND_IBRITHDAY.Text = string.Format("{0:D}", Convert.ToDateTime(dt.Rows[0]["IND_IBRITHDAY"].ToString()));
      }
      this.IND_IADDRESS.Text = dt.Rows[0]["IND_IADDRESS"].ToString();

      if (dt.Rows[0]["IND_IS_BLOG"].ToString() == "是")
      {
          this.IND_IS_BLOG1.Checked = true;
      }
      else
      {
          this.IND_IS_BLOG2.Checked = true;
      }
      this.IND_BURL.Text = dt.Rows[0]["IND_BURL"].ToString();
      if (dt.Rows[0]["IND_FAXTIME"].ToString() == "1900/1/1 0:00:00")
      {
          this.IND_FAXTIME.Text = "";
      }
      else
      {
          this.IND_FAXTIME.Text = string.Format("{0:D}", Convert.ToDateTime(dt.Rows[0]["IND_FAXTIME"].ToString()));
      }
      this.IND_FAXREMARK.Text = dt.Rows[0]["IND_FAXREMARK"].ToString();
      this.IND_ATTACHMENT_1.Text = dt.Rows[0]["IND_ATTACHMENT_1"].ToString();
      this.IND_ATTACHMENT_2.Text = dt.Rows[0]["IND_ATTACHMENT_2"].ToString();
      this.IND_ATTACHMENT_3.Text = dt.Rows[0]["IND_ATTACHMENT_3"].ToString();
      this.IND_ATTACHMENT_4.Text = dt.Rows[0]["IND_ATTACHMENT_4"].ToString();
      this.IND_ATTACHMENT_5.Text = dt.Rows[0]["IND_ATTACHMENT_5"].ToString();
      this.IND_ATTACHMENT_6.Text = dt.Rows[0]["IND_ATTACHMENT_6"].ToString();
      this.IND_ATTACHMENT_7.Text = dt.Rows[0]["IND_ATTACHMENT_7"].ToString();
      this.IND_ATTACHMENT_8.Text = dt.Rows[0]["IND_ATTACHMENT_8"].ToString();
      this.IND_ATTACHMENT_9.Text = dt.Rows[0]["IND_ATTACHMENT_9"].ToString();
      this.IND_ATTACHMENT_10.Text = dt.Rows[0]["IND_ATTACHMENT_10"].ToString();
      if (this.IND_ATTACHMENT_1.Text != "")
      {
          this.Panel1.Visible = true;
      }
      if (this.IND_ATTACHMENT_2.Text != "")
      {
          this.Panel2.Visible = true;
      }
      if (this.IND_ATTACHMENT_3.Text != "")
      {
          this.Panel3.Visible = true;
      }
      if (this.IND_ATTACHMENT_4.Text != "")
      {
          this.Panel4.Visible = true;
      }
      if (this.IND_ATTACHMENT_5.Text != "")
      {
          this.Panel5.Visible = true;
      }
      if (this.IND_ATTACHMENT_6.Text != "")
      {
          this.Panel6.Visible = true;
      }
      if (this.IND_ATTACHMENT_7.Text != "")
      {
          this.Panel7.Visible = true;
      }
      if (this.IND_ATTACHMENT_8.Text != "")
      {
          this.Panel8.Visible = true;
      }
      if (this.IND_ATTACHMENT_9.Text != "")
      {
          this.Panel9.Visible = true;
      } 
       if (this.IND_ATTACHMENT_10.Text != "")
      {
          this.Panel10.Visible = true;
      }



      //this.CREATETIME.Text = dt.Rows[0]["CREATETIME"].ToString();
    }

    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {

        //this.IND_ATTACHMENT_1.Text;
      //  Response.Write("<script>window.open('RequesImages.aspx?img=" + this.IND_ATTACHMENT_1.Text + "');</script>");
        //Response.ContentType = "image/jpeg";
        //      Response.AppendHeader("Content-Disposition", "attachment; filename=SailBig.jpg");
        //      Response.TransmitFile(Server.MapPath("/pub/crm/exportfiles/") + down_file.Value);
        //      Response.End();
    }
}
